Redirect if Previous Visit

If a visitor has already visited their page in the past, you may want to redirect them to a different page.  To do so, you would add the following code to the index.php landing page file, just below the PURL CODE.

Redirect code

The code is saying...  "If the visitor has history (visited the page in the past), AND they are on the Welcome Page (Page 1), then redirect them to yoursite.com."

if(isset($visitor->history) && $_GET['page'] == 1) {
   header( 'Location: http://www.yoursite.com' ) ;
}
	

Alternative error message code

You can also use a similar bit of code to show an error instead of redirecting:

if(isset($visitor->history) && $_GET['page'] == 1) {
   echo 'You already visited this page';
   exit; 
}